//
//  MeBalanceVC.m
//  BrushFace
//
//  Created by Zzz on 16/1/17.
//  Copyright © 2016年 Zzz. All rights reserved.
//

#import "MeBalanceVC.h"
#import "UIView+UIView_ITAdditions.h"
#import "ChongZhiVC.h"
#import "MySceneModel.h"
#import "WithdrawalVC.h"
#import "DealDetail.h"

@interface MeBalanceVC ()
@property (weak, nonatomic) IBOutlet UILabel *balanceCount;
@property (nonatomic,strong)MySceneModel *reqmodel;
@end

@implementation MeBalanceVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navBar setTitle:@"余额"];
    [self.navBar setLeftBtn:NAV_BAR_LEFT_BTN_TYPE_BLUE];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

    _reqmodel = [MySceneModel SceneModel];
    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [rightBtn setSize:CGSizeMake(70, 44)];
    [rightBtn setTitle:@"交易明细" forState:UIControlStateNormal];
    [rightBtn setTintColor:[UIColor lightGrayColor]];
    [rightBtn addTarget:self action:@selector(clickDetail) forControlEvents:UIControlEventTouchUpInside];
    [rightBtn.titleLabel setFont:[UIFont systemFontOfSize:12]];
    [self.navBar setRightView:rightBtn];
    
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [_reqmodel user_getAccountAndCB:^(id output) {
        _balanceCount.text = [NSString stringWithFormat:@"¥%@",[output objectForKey:@"amount"]];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

- (void)clickDetail{
    // 明细
    DealDetail *dealVC = [[DealDetail alloc] init];
    [dealVC setHidesBottomBarWhenPushed:YES];
    [self.navigationController pushViewController:dealVC animated:YES];
}

- (IBAction)clickRecharge:(id)sender {
    // 充值
    ChongZhiVC *vc = [[ChongZhiVC alloc] init];
    [vc setHidesBottomBarWhenPushed:YES];
    [self.navigationController pushViewController:vc animated:YES];
}

- (IBAction)clickWithDrow:(id)sender {
    //提现
    WithdrawalVC *vc = [[WithdrawalVC alloc] init];
    [vc setHidesBottomBarWhenPushed:YES];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
